export const basicRoutes = [
  {
    name: 'Index',
    path: '/',
    redirect: '/admin/index',
  },
  {
    name: '404',
    path: '/404',
    component: () => import('@/views/error-page/404.vue'),
    isHidden: true,
  },
  {
    name: 'AdminLogin',
    path: '/admin/login',
    component: () => import('@/views/admin/login/index.vue'),
    isHidden: true,
    meta: {
      title: '管理员登录页',
    },
  },
  {
    name: 'AdminRegister',
    path: '/admin/register',
    component: () => import('@/views/admin/login/register.vue'),
    isHidden: true,
    meta: {
      title: '管理员注册',
    },
  },
  {
    name: 'AdminResetPassword',
    path: '/admin/reset-password',
    component: () => import('@/views/admin/login/reset-password.vue'),
    isHidden: true,
    meta: {
      title: '管理员密码重置',
    },
  },
  {
    name: 'AdminRePwInfo',
    path: '/admin/re-pw-info',
    component: () => import('@/views/admin/login/re-pw-info.vue'),
    isHidden: true,
    meta: {
      title: '管理员忘记密码',
    },
  },
]

export const NOT_FOUND_ROUTE = {
  name: 'NotFound',
  path: '/:pathMatch(.*)*',
  redirect: '/404',
  isHidden: true,
}

export const EMPTY_ROUTE = {
  name: 'Empty',
  path: '/:pathMatch(.*)*',
  component: null,
}

export const ADMIN_UNAUTH_ROUTE = {
  name: 'AdminUnauth',
  path: '/:pathMatch(.*)*',
  redirect: '/admin/login',
}

const modules = import.meta.glob('@/views/**/route.js', { eager: true })
const asyncRoutes = []
Object.keys(modules).forEach((key) => {
  asyncRoutes.push(modules[key].default)
})

export { asyncRoutes }
